package com.easylinkin.linkappapi.intelligentrule.constant;

/**
 * <p>
 * 智能规则管理常量
 * </p>
 *
 * @author TongJie
 * @since 2020/4/30 15:01
 */
public interface IntelligentRuleConstant {

    enum RuleStatusEnum {
        /**
         * 2, 启用
         */
        ENABLED(2, "启用"),
        /**
         * 1, 停用
         */
        DISABLED(1, "停用");


        private final Integer type;
        private final String name;

        RuleStatusEnum(Integer type, String name) {
            this.type = type;
            this.name = name;
        }

        public Integer getType() {
            return type;
        }

        public String getName() {
            return name;
        }
    }

    enum IntelligentRuleTypeEnum {
        /**
         * 1, 属性规则
         */
        ATTRIBUTE_TYPE(1, "属性规则"),
        /**
         * 2, 通用规则
         */
        COMMON_TYPE(2, "通用规则");


        private final Integer type;
        private final String name;

        IntelligentRuleTypeEnum(Integer type, String name) {
            this.type = type;
            this.name = name;
        }

        public Integer getType() {
            return type;
        }

        public String getName() {
            return name;
        }
    }

    /**
     * 作用范围
     */
    enum ActionScopeEnum {


        /**
         * 1, 作用于型号
         */
        SCOPE_DEVICE_UNIT(1, "型号"),
        /**
         * 2, 作用于设备
         */
        SCOPE_DEVICE(2, "设备");


        private final Integer type;
        private final String name;

        ActionScopeEnum(Integer type, String name) {
            this.type = type;
            this.name = name;
        }

        public Integer getType() {
            return type;
        }

        public String getName() {
            return name;
        }

        /**
         * 通过 type 获取类型枚举
         */
        public static ActionScopeEnum valueOf(Integer type) {
            if (null == type) {
                return null;
            }
            switch (type) {
                case 1:
                    return SCOPE_DEVICE_UNIT;
                case 2:
                    return SCOPE_DEVICE;
                default:
                    return null;
            }
        }

    }

}
